package com.wyyc.common.user.repository;

import com.wyyc.entity.UsersEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Hwei~ on 2017/6/6.
 */
@Repository
@Transactional
public interface UserRepository extends PagingAndSortingRepository<UsersEntity, Integer>, JpaRepository<UsersEntity, Integer> {

    //根据手机号查询用户
    @Query("FROM UsersEntity user where user.phone = ?1")
    UsersEntity findByPhone(String phone);
}
